package net;

import com.sun.org.apache.bcel.internal.generic.Select;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;

/**
 * @author： pang-yun
 * @date： 2021-09-06 15:11
 * 功能目的 ：用于
 */

public class Read {
    public static void main(String[] args) throws IOException {
        Selector open = Selector.open();
        ServerSocketChannel ssc = ServerSocketChannel.open();
        ssc.configureBlocking(false);
        SelectionKey selectionKey = ssc.register(open, 0, null);
        selectionKey.interestOps(SelectionKey.OP_ACCEPT);
        ssc.bind(new InetSocketAddress(9999));
    }
}
